﻿namespace zijian666.Data;

public class DbInterceptorContext(IDbConnection conn, long timestamp, CancellationToken cancellationToken)
{
    private readonly long _startTimestamp = timestamp;
    public IDbConnection Connection { get; } = conn;
    public CancellationTokenSource Cts { get; } = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
    public TimeSpan Elapsed => TimeSpan.FromTicks(Stopwatch.GetTimestamp() - _startTimestamp);
}
